<template>
    <div>
        <div class="title">this is page for {{name}}</div>
    </div>
</template>
<script>
export default {
    data() {
        return {
            name:"Vue"
        }
    },
    methods: {
        getData(){
            this.$http.get('/rest/test',{params:{name:"cloud"}})
            .then(resp=>{
                if(resp.data.code == 200){
                    //处理数据
                    this.name = resp.data.result.name;
                }else{
                    alert(resp.data.msg);
                }
            })
            .catch(resp=>{
                console.log(resp);
            })
        }
    },
    mounted() {
        this.getData();
    },
}
</script>
<style lang="css">
    .title{
        font-size: 1.5rem;
    }
</style>